1. Field of the Invention
This invention relates generally to a system for accessing shared data using multiple application servers. More particularly, it invention relates to a method, system, and computer program for use in accessing shared data using multiple application servers.
2. Description of the Related Art
There is known a system which includes a database server storing a database and multiple application servers for accessing the database. Such a system causes each application server to cache the result of a read of the database, thereby reducing the load imposed on the database server.
In a system causing each application server to cache the result of a read of the database, a lock control must be performed among the multiple application servers in order to prevent a read of cached data inconsistent with the database. Examples of a lock control method include the distributed-lock method in which each application server controls a lock individually, and the centralized-lock method in which a lock server or the like centrally controls a lock. Hereafter, a lock control performed using the distributed-lock method will be referred to as “cache mode” and a lock control performed using the centralized-lock method will be referred to as “database mode.”
If an application server reads a database in a system that is using cache mode, the application server acquires a locally controlled read lock before reading the database. Also, if the application server updates the database in the system that is using cache mode, the application server acquires an exclusive lock controlled by each of the other application servers before updating the database. On the other hand, if an application server reads or updates a database in a system which is using database mode, the application server acquires a read lock or an exclusive lock controlled by a lock server before reading or updating the database.
As for cache mode, the latency caused when acquiring a read lock is short. However, an exclusive lock must be acquired from each of multiple application servers. This complicates the process. On the other hand, as for database mode, it is sufficient to only acquire one exclusive lock from a lock server. This simplifies the process. However, the latency caused when acquiring a read lock is long. Therefore, cache mode is preferably used in a system for realizing an application where a read of a database frequently occurs, and database mode is preferably used in a system for realizing an application where an update of a database frequently occurs.
In a system for realizing bank operations or the like, a read of a database occurs more frequently than a database update during daytime hours. A batch update of the database is performed during the nighttime when the database is used by users less frequently. If cache mode is used in such a system, the operation efficiency is increased during the daytime when a read of the database occurs more frequently. However, the operation efficiency is reduced during the nighttime when a batch update is performed. In contrast, if database mode is used in such a system, the operation efficiency is increased during the nighttime when a batch update is performed; however, the operation efficiency is reduced during the daytime when a read of the database occurs more frequently. Therefore, it is difficult to increase the operation efficiency regardless of the time of day in a system for realizing an application where an update of a database occurs more frequently during a particular time period.